import { useAxios } from '@/hooks/web/useAxios'
import type { UserLoginType } from './types'

const request = useAxios()

export const loginApi = (data: UserLoginType) => {
  return request.post({
    url: '/user/auth/login',
    data,
    headersType: 'application/x-www-form-urlencoded'
  })
}
export const loginOutApi = () => {
  return request.post({
    url: '/user/auth/logout',
    headersType: 'application/x-www-form-urlencoded'
  })
}

/**
 * @description 修改密码
 * @author Elwin ZHANG
 * @date 2022/5/18 16:35
 */
export const updatePassWord = (params) => {
  return request.post({
    url: 'user/user/updatePassWord',
    params,
    headersType: 'application/x-www-form-urlencoded'
  })
}
/**
 * @description 获取当前用户已授权的菜单
 * @author Elwin ZHANG
 * @date 2022-05-27 16:49
 */
export const getUserMenus = () => {
  return request.post({
    url: 'user/menu/getUserMenus',
    headersType: 'application/x-www-form-urlencoded'
  })
}
/**
 *@author lxc
 *@description:谷歌验证
 *@param:
 *@date: 2022-06-20 17:20:12
 **/
export const googleVerify = (data) => {
  return request.postXww({
    url: '/user/auth/bind',
    data
  })
}
